package com.icss.day07.mapper;

import com.icss.day07.vo.Employees;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;

@Mapper
public interface EmployeesMapper {

    @Select("\n" +
            "SELECT e.employee_id,\n" +
            "       e.first_name,\n" +
            "       e.last_name,\n" +
            "       e.email,\n" +
            "       e.phone_number,\n" +
            "       e.job_id,\n" +
            "       e.salary,\n" +
            "       e.commission_pct,\n" +
            "       e.manager_id,\n" +
            "       e.department_id,\n" +
            "       e.hiredate from employees e ")
    List<Employees> searchAll();


    @Insert(" INSERT INTO employees (first_name, last_name, email, phone_number, job_id, salary, commission_pct, manager_id, department_id, hiredate) " +
            "   VALUES (#{firstName}, #{lastName}, #{email}, '12321312', 'AD_PRES', 4000, null, 100, #{departmentId}, #{hiredate})")
    int insertOne(Employees condition);
}
